package com.ruibang.glass.material.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruibang.glass.material.domain.req.MaterialBalanceReq;
import com.ruibang.glass.material.dto.MaterialALLInventoryManagementDTO;
import com.ruibang.glass.material.dto.MaterialBalanceDTO;
import com.ruibang.glass.material.entity.MaterialALLInventoryManagement;
import com.ruibang.glass.material.entity.MaterialCpBcpItems;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 原材料库存管理表 Mapper 接口
 * </p>
 *
 * @author mameng
 * @since 2024-04-01
 */
@Mapper
public interface GMaterialALLInventoryManagementMapper extends BaseMapper<MaterialALLInventoryManagement> {

    Page<MaterialBalanceDTO> pageMaterialBalanceDTO(IPage<MaterialBalanceDTO> page, @Param("materialBalanceReq") MaterialBalanceReq materialBalanceReq);
    Page<MaterialBalanceDTO> pageMaterialCPBalanceDTO(IPage<MaterialBalanceDTO> page, @Param("materialBalanceReq") MaterialBalanceReq materialBalanceReq);
    Page<MaterialBalanceDTO> pageMaterialBCPBalanceDTO(IPage<MaterialBalanceDTO> page, @Param("materialBalanceReq") MaterialBalanceReq materialBalanceReq);

    /**
     * @param itemName
     * @param itemCode
     * @param warehouseCode
     * @param datetime
     * @return
     */
    MaterialBalanceDTO getMaterialBalanceDTOIn(@Param("itemName") String itemName, @Param("itemCode") String itemCode, @Param("warehouseCode") String warehouseCode, @Param("datetime") Date datetime,
                                             @Param("tableName") String tableName);

    MaterialBalanceDTO getMaterialBCPBalanceDTOIn(@Param("itemName") String itemName, @Param("itemCode") String itemCode, @Param("warehouseCode") String warehouseCode, @Param("datetime") Date datetime
                                             );

    MaterialBalanceDTO getMaterialCPBalanceDTOIn(@Param("itemName") String itemName, @Param("itemCode") String itemCode, @Param("warehouseCode") String warehouseCode, @Param("datetime") Date datetime
                                             );


    MaterialBalanceDTO getCpOther(@Param("itemName") String itemName, @Param("itemCode") String itemCode);

    MaterialBalanceDTO getMaterialBalanceDTOOut(@Param("itemName") String itemName, @Param("itemCode") String itemCode, @Param("warehouseCode") String warehouseCode, @Param("datetime") Date datetime
                                            );

    MaterialBalanceDTO getMaterialBCPBalanceDTOOut(@Param("itemName") String itemName, @Param("itemCode") String itemCode, @Param("warehouseCode") String warehouseCode, @Param("datetime") Date datetime
                                            );

    MaterialBalanceDTO getMaterialCPBalanceDTOOut(@Param("itemName") String itemName, @Param("itemCode") String itemCode, @Param("warehouseCode") String warehouseCode, @Param("datetime") Date datetime
                                            );

    MaterialBalanceDTO getMaterialBalanceDTOQm(@Param("itemName") String itemName, @Param("itemCode") String itemCode, @Param("warehouseCode") String warehouseCode);

    MaterialBalanceDTO getMaterialBCPBalanceDTOQm(@Param("itemName") String itemName, @Param("itemCode") String itemCode, @Param("warehouseCode") String warehouseCode);

    MaterialBalanceDTO getMaterialCPBalanceDTOQm(@Param("itemName") String itemName, @Param("itemCode") String itemCode, @Param("warehouseCode") String warehouseCode);


    BigDecimal getDJQuality(@Param("itemName") String itemName, @Param("itemCode") String itemCode, @Param("ids") List<String> ids);

    BigDecimal getDJYClQuality(@Param("itemCode") String itemCode, @Param("batchNumber") String batchNumber, @Param("brocadeNumber") String brocadeNumber, @Param("ids") List<String> ids);

    BigDecimal getBCPDJYClQuality(@Param("aTypeCode") String aTypeCode);

    BigDecimal getCPDJYClQuality(@Param("aTypeCode") String aTypeCode);

    BigDecimal getDBDJQuality(@Param("itemName") String itemName, @Param("itemCode") String itemCode);

    String getSupplierName(@Param("supplier") String supplier);

    List<MaterialALLInventoryManagementDTO> getMaterialALLInventoryManagementDTO();

    MaterialALLInventoryManagement getMaterialALLInventoryManagementByPcNumber(@Param("pcNumber") String pcNumber);

    List<MaterialALLInventoryManagementDTO> getMaterialALLInventoryManagementDTOBYPC();


    List<String> getNewTPH();

    MaterialALLInventoryManagement getMaterialALLInventoryManagement(@Param("aTypeShelf") String aTypeShelf);

    List<MaterialALLInventoryManagement> getMaterialLocationSelectList();


    List<MaterialALLInventoryManagement> getMaterialLocationByItemCode(@Param("itemCode") String itemCode);

    List<MaterialALLInventoryManagementDTO> getYclLocationMaterial(@Param("barcodeNumber") String barcodeNumber,@Param("batchNumber") String batchNumber);

    List<MaterialCpBcpItems> getMatericalGetList();


}
